using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace TankWars.Items
{
    public class ItemManager
    {
        private Dictionary<Type, Texture2D> dicItemTextures = new Dictionary<Type, Texture2D>();

        public List<Item> lstItems;

        public ItemManager(Dictionary<Type, Texture2D> itemTextures)
        {
            this.dicItemTextures = itemTextures;
        }

        public void PlaceNewItem(Type itemType, Vector2 position)
        {
            if(itemType.BaseType == typeof(Item))
            {
                Item newItem = (Item)itemType.GetConstructor(new Type[] { typeof(Texture2D), typeof(Vector2) }).Invoke(new object[] { this.dicItemTextures[itemType], position });

                this.lstItems.Add(newItem);
            }
        }
    }
}